package com.boost.bio.line;

import java.io.IOException;

public class ReadLineFactory {
    public static ReadLine getInstens(String path, String splitLine, String splitFiled) throws IOException {
        if (splitLine == null || splitLine.equals("\n") || splitLine.equals("\r") || splitLine.equals("\r\n")) {
            return new NormalReadLine(path, !(splitFiled == null || "".equals(splitFiled)) ? splitFiled : null);
        }
        if(splitLine==null && splitFiled.length()>0)
        {
            return new NormalReadLine(path,splitFiled);
        }
        if(splitLine.length()>1 || splitFiled.length()>1){
            return new ComplexReadLine(path,splitLine.toCharArray(), splitFiled.toCharArray());
        }else if (splitLine.length()==1 && splitFiled.length()==1){
            return new SingleReadLine(path,splitLine.charAt(0), splitFiled.charAt(0));
        }
        return null;
    }
}
